<html>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $("#submit").click(function(){
                var mobile = $("#mobile").val();
                var password = $("#password").val();
                var role = $("#role").val();

                $.ajax({
                    url: 'http:/login.do',
                    contentType: "application/json",
                    type: 'post',
                    dataType: 'json',
                    data: JSON.stringify({
                        "role": role,
                        "password": password,
                        "mobile": mobile
                    }),
                    error: function (error) {
                        alert('error');
                    },
                    success: function (data) {
                        alert('success');
                        $("#dis").html(JSON.stringify(data));
                    }
                });
            });
        });
    </script>
</head>
<body>
<form>
    <input id="role" name="role" value="buyer" type="hidden"> <br>
    手机号码:<input id="mobile" name="mobile" type="text"><br>
    密码:<input id="password" name="password" type="password"><br>
    <input id="submit" name="submit" value="登陆" type="button"><br>

    <div id="dis"></div>
</form>

</body>
</html>